/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 package com.kairos.motion.strategy
{ 
	/**
	 * <code>PlayStrategy</code> define rules to create animation strategy for
	 * the <code>AbstractAnimation</code> class.
	 * 
	 * @author 	Cédric Néhémie
	 * @see		com.kairos.motion.AbstractAnimation
	 */
	public interface PlayStrategy 
	{
		/**
		 * Returns the initial frame onto which the playhead is at start.
		 * 
		 * @return	the initial frame onto which the playhead is at start
		 */
		function getInitialFrame ( totalFrames : uint ) : uint;
		
		/**
		 * Returns <code>true</code> if the animation have to stop
		 * at the end of the playhead moves.
		 * <p>
		 * Concret class which are non-looping strategy may return
		 * <code>false</code> in <code>isMotionFinished</code> and
		 * matching looping condition only in <code>getNextFrame</code>
		 * method.
		 * </p>
		 * 
		 * @param	frame		number of the current frame in the animation
		 * @param	totalFrames	number of frames in the animation
		 * @param	step		how many frames the playhead have to move.
		 * @return	<code>true</code> if the animation have to stop after
		 * 			the	playhead moves, either <code>false</code>
		 */
		function isMotionFinished ( frame : uint, totalFrames : uint, step : uint ) : Boolean;
		
		/**
		 * Returns the next frame wherein the playhead can move.
		 * <p>
		 * When building non-looping strategy the function may return
		 * the last valid frame wherin the playhead can move when arriving
		 * to the end condition during the move.
		 * </p>
		 * 
		 * @param	frame		number of the current frame in the animation
		 * @param	totalFrames	number of frames in the animation
		 * @param	step		how many frames the playhead have to move.
		 * @return	A valid frame index in the <code>MovieClip</code>
		 */
		function getNextFrame ( frame : uint, totalFrames : uint, step : uint ) : uint;
	}
}